package websocket.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import websocket.dto.ResultDTO;
import websocket.entity.dto.ZhuanTaiDTO;
import websocket.service.ZhuanTaiService;

/**
 * @author neiruijie
 * @date 2022年9月16日10:49:07
 * 双轴转台Controller
 */
@RestController
@RequestMapping("/api/zhuan-tai")
@Api(tags = "双轴转台Controller")
public class ZhuanTaiController {

    @Autowired
    private ZhuanTaiService zhuanTaiService;

    @PostMapping("/connect")
    @ApiOperation(value = "双轴转台串口通讯", response = ZhuanTaiDTO.class)
    public ResultDTO connect(@RequestBody ZhuanTaiDTO zhuanTaiDTO) {
        return zhuanTaiService.zhuanTaiConnect(zhuanTaiDTO);
    }

    @PostMapping("/connect-cancel")
    @ApiOperation(value = "双轴转台串口通讯关闭", response = ZhuanTaiDTO.class)
    public ResultDTO connectCancel(@RequestBody ZhuanTaiDTO zhuanTaiDTO) {
        return zhuanTaiService.connectCancel(zhuanTaiDTO);
    }

    @PostMapping("/shi-neng")
    @ApiOperation(value = "双轴转台使能", response = ZhuanTaiDTO.class)
    public ResultDTO zhuanTaiShiNeng(@RequestBody ZhuanTaiDTO zhuanTaiDTO) {
        return zhuanTaiService.zhuanTaiShiNeng(zhuanTaiDTO);
    }

    @PostMapping("/shi-neng-cancel")
    @ApiOperation(value = "双轴转台使能取消", response = ZhuanTaiDTO.class)
    public ResultDTO zhuanTaiShiNengCancel(@RequestBody ZhuanTaiDTO zhuanTaiDTO) {
        return zhuanTaiService.zhuanTaiShiNengCancel(zhuanTaiDTO);
    }

    @PostMapping("/run")
    @ApiOperation(value = "双轴转台运行（内环/外环/自动调平）", response = ZhuanTaiDTO.class)
    public ResultDTO runZhuanTai(@RequestBody ZhuanTaiDTO zhuanTaiDTO) {
        return zhuanTaiService.runZhuanTai(zhuanTaiDTO);
    }
}
